<?php 
    $valuteTotal = $this->Session->read("valutalist");
    $categorieTotal = $this->Session->read("categorylist");
	// pr(Configure::read("Config.language"));
?>
<div class="row">
    <h2 class="text-center" style="">Posts</h2>
        <div class="table-responsive">
        <table class="table-striped table-hover table-condensed text-center table-responsive" style="width: 95%;background: #fff;font-size: 12px;">
            <thead >
                <tr style="background-color:#414141;color:#fff;">
                    <th class="text-center"><?php echo __("Titolo"); ?></th>
                    <th class="text-center"><?php echo __("Stato"); ?></th>
                    <?php if($this->Session->read("Auth.User")) { ?>
                        <th class="text-center" colspan="2">Azioni</th>
                    <?php } ?>
                </tr>
            </thead>
            <?php if($this->Session->read("Auth.User")) { ?>
                <tfoot>
                    <tr class="text-right">
                        <td colspan="13"><a href="<?php echo $this->webroot?>Post/add"><i class="fa-plus"></i> Scrivi Post</a></td>
                    </tr>
                </tfoot>
            <?php } ?>
            <tbody>
               <?php if(count($posts)==0){ ?>
                 <tr><td colspan="5"><?php __("Argomento non trovato!"); ?></td></tr>  
                   
               <?php }?>
               <?php foreach($posts as $key=>$post){?>
                <tr>
                    <td><?php echo $post["PostLang"][Configure::read("Config.language")]["title"]?></td>
                    <td><?php echo $post["Post"]["status"]?></td>
                    
                    <?php if($this->Session->read("Auth.User")) { ?>
                        <td><a href="<?php echo $this->webroot?>Post/edit/<?php echo $post["Post"]["id"]?>"><i class="fa-pencil"></i></a></td>
					    <td><?php echo $this->Acl->link("<i class='fa-trash-o'></i>", array('controller'=>'Post', 'action'=>'delete', $post["Post"]["id"]), array("data-confirm" => "true", "tabindex"=>-1, "role"=>"menuitem", "escape"=>false),null,null,null,true);  ?></td>
                    <?php } ?>
                </tr>
               <?php }?>
            </tbody>
        </table>
    </div>
</div>